<template>
  <div>
    <el-form :model="innerData" :rules="rules" ref="ruleForm" label-width="100px">
      <el-form-item label="权益序号" prop="commodity_name">
        <el-input
          type="number"
          class="w400"
          placeholder="请输入"
          v-model="innerData.benefit_rank"
          autocomplete="off"
        ></el-input>
      </el-form-item>
      <el-form-item label="权益图片" >
        <upimg :ismultiple="false" :imgs.sync="innerData.benefit_img" />
      </el-form-item>
      <el-form-item label="权益名称" prop="benefit_name">
        <el-input
          class="w400"
          placeholder="请输入"
          v-model="innerData.benefit_name"
          autocomplete="off"
        ></el-input>
      </el-form-item>
      <el-form-item label="权益说明" >
        <quilleditor v-model="innerData.benefit_content" />
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import upimg from 'components/upimg/upimg';
import quilleditor from 'components/quilleditor';
export default {
  components: {
    upimg,
    quilleditor
  },
  props: {
    formData: {
      default: {}
    }
  },
  computed: {
    // innerData(){
    //   return {...this.formData}
    // }
  },
  watch: {
    formData: {
      handler: function(val) {
        this.innerData = val
        // this.$emit('update:formData', this.innerData)
      },
      // deep: true,
      immediate: true
    },
    innerData: {
      handler: function(val) {
        // console.log(val)
        this.$emit('update:formData', val)
      },
      deep: true
    },
    // imgs: {
    //   handler: function() {
    //     this.innerData.benefit_img = this.imgs.join(',')
    //   },
    //   deep: true
    // }
  },
  data() {
    return {
      imgs: [],
      rules: {},
      innerData: {}
    }
  }
}
</script>

<style lang="scss" scoped>
.w400{
  width: 400px;
}
</style>